"""
数据转换工具
"""
from typing import Dict, Any


class DataTransformer:
    """
    数据转换工具
    """
    def transform(self, data: Dict[str, Any], rules: Dict[str, Any]) -> Dict[str, Any]:
        """
        转换数据
        
        Args:
            data: 原始数据
            rules: 转换规则
        """
        transformed_data = {}
        
        for field, rule in rules.items():
            if field in data:
                transformed_data[field] = rule(data[field])
        
        return transformed_data